<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    async function main(){
      //main函数开始与第一个 await 之间的代码是同步执行的
      console.log(111);
      let res = await new Promise((resolve, reject) => {
        resolve('OKOK');
      });
      console.log(333);
    }

    main();
    console.log(222);

    async function main2(){
      //main函数开始与第一个 await 之间的代码是同步执行的
      console.log(444);
      let res = await new Promise((resolve, reject) => {
        resolve('OKOK');
      });
      console.log(666);
    }

    main2();
    console.log(555);
  </script>
</body>
</html>